package view
{
	import assets.Assets;
	
	import component.Macario;
	
	import mx.controls.Text;
	
	import org.osflash.signals.Signal;
	
	import starling.core.Starling;
	import starling.core.starling_internal;
	import starling.display.Image;
	import starling.display.Sprite;
	import starling.events.Event;
	import starling.events.KeyboardEvent;
	import starling.textures.Texture;
	
	public class Game extends Sprite
	{
		public static const signals:Signal = new Signal();
		
		private var character:Macario;
		
		private var mStarling:Starling;
		public function Game()
		{
			super();
			this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
		}
		
		private function onAddedToStageHandler(event:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
			initBackground();
			initCharacter();
		}
		
		private function initBackground():void
		{
			var backgroundTexture:Texture = Assets.getTexture("Background");
			var backgroundImage:Image = new Image(backgroundTexture);
			addChild(backgroundImage);
		}
		
		private function initCharacter():void
		{
			character = new Macario();
			character.x = stage.stageWidth/2;
			character.y = stage.stageHeight/2;
			this.addChild(character);
		}		
		
	}
}